const express = require('express')
const controller = require('./controller')
// const fs = require('fs')
// const tar = require('tar')

const app = express()

app.listen(3601, err => {
    console.log(err ? err : "服务器开启成功，端口号3601")
})

const bodyParser = require('body-parser')
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))

app.engine("art", require("express-art-template"))
app.set("view engine", "art")
app.set("views", "./public")

app.post('/create/code', (req, res) => {
    controller.getFileTem(req, res)
})

module.exports = app
// tar.c(
//     {
//         gzip: true // this will perform the compression too
//     },
//     ["public"]
// ).pipe(fs.createWriteStream('file/dir.tgz'));